using System;

using Engine.Physics;

namespace Test
{
    /// <summary>
    ///     Physical simulation
    /// </summary>
    public class PhysicsSimulation
    {
        static void Main(string[] args)
        {
            Dimension world = new Dimension();

            Body earth = new Body("Earth");
            earth.Mass = 5.98e24f;
            
            Body jeroen = new Body("Jeroen");
            jeroen.Mass = 70f;
            jeroen.Position = new Engine.Math.Vector3(0, 6356750, 0);

            world.AddPhysical(earth);
            world.AddPhysical(jeroen);

            for(int i = 0; i < 10; i++)
            {
                // Calculate force
                Console.WriteLine(jeroen.GravitationalForce(earth) + "N");

                // Set body acceleration, based on gravitational force
                jeroen.Acceleration = jeroen.Acceleration + jeroen.GravitationalAcceleration(earth);

                // Simulate body
                world.Simulate();

                // Display body
                Console.WriteLine(jeroen.ToString());
            }

            Console.Read();
        }
    }
}
